<template> 
  <div class="shop-info">

    <div class="shop-top">
      <img :src="shop.logo" alt="" class="shop-logo">
      <span class="shop-name">{{shop.name}}</span>
    </div>

    <div class="shop-bottom">
      <div class="shop-left shop-flex">
        <div class="shop-sells left-message">
          <div class="shop-sells-number">
            <!-- filters过滤器 -->
            {{shop.cSells | sellCountFilter}}
          </div>
          <div class="shop-sells-text">总销量</div>
        </div>
        <div class="shop-count left-message">
          <div class="shop-count-number">
            {{shop.cGoods}}
          </div>
          <div class="shop-count-text">全部宝贝</div>
        </div>
      </div>
      
      <div class="shop-right shop-flex">
        <table>
          <tr v-for="(item, index) in shop.score" :key="index">
            <td>{{ item.name }}</td>
            <td class="score" :class="{ 'score-better': item.isBetter }">
              {{ item.score }}
            </td>
            <td class="better" :class="{ 'better-more': item.isBetter }">
              <span>{{ item.isBetter ? "高" : "低" }}</span>
            </td>
          </tr>
        </table>
      </div>
    </div>

    <div class="shop-enter">
      <div class="enter-shop">进店逛逛</div>
    </div>
  </div>
</template>

<script>
export default {
  name: "DetailShopInfo",
  props: {
    shop:{
      type:Object,
      dafult(){
        return {}
      }
    }
  },
  filters: {
    sellCountFilter(value){
      if(value < 10000){
        return value
      }else{
        return (value/10000).toFixed(1) + '万'
      }
    }
  }
};
</script>

<style scoped>
.shop-top{
  padding: 20px 15px;
}
.shop-logo{
  height: 50px;
  width: 50px;
  border-radius: 25px;
  border: 1.5px solid #DDE1E5;
  margin-right: 10px;
}
.shop-name{
  position: relative;
  top: -20px;
}

.shop-bottom{
  display: flex;
}
.shop-flex{
  flex: 1;
}
.shop-left{
  display: flex;
  justify-content: space-evenly;
  color: #333;
  text-align: center;
  border-right: 1px solid rgba(0, 0, 0, 0.1);
}
.shop-sells-number,.shop-count-number{
  font-size: 19px;
}
.shop-sells-text,.shop-count-text{
  margin-top: 8px;
  font-size: 12px;
}
.shop-right{
  padding-left: 25px;
}
.shop-right td{
  padding: 5px 6px;
}
.score{
  color:#5A9C2A;
}
.score-better{
  color: #FF5777;
}
.better{
  background-color: #5A9C2A;
  color: white;
}
.better-more{
  background-color: #FF5777;
}
.shop-enter{
  margin-top: 10px;
  text-align: center;
}
.enter-shop{
  width: 150px;
  height: 30px;
  background-color: #f2f5f8;
  display: inline-block;
  text-align: center;
  border-radius: 10px;
  line-height: 30px;
}
</style>
